/*     */ package com.lmpop.trade.ti_custnews;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_custnewsInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_custnewsInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_custnews ti_custnews = new Ti_custnews();
/*  27 */     ti_custnews.setNews_id(map.getString("news_id"));
/*  28 */     ti_custnews.setCust_id(map.getString("session_cust_id"));
/*  29 */     ti_custnews.setCh_id_group(map.getString("ch_id_group"));
/*  30 */     ti_custnews.setTitle(map.getString("title"));
/*  31 */     ti_custnews.setContent(map.getString("content"));
/*  32 */     ti_custnews.setTitle_color(map.getString("title_color"));
/*  33 */     ti_custnews.setContent_sub(map.getString("content_sub"));
/*  34 */     ti_custnews.setNews_key(map.getString("news_key"));
/*  35 */     ti_custnews.setAuthor(map.getString("author"));
/*  36 */     ti_custnews.setEditor(map.getString("editor"));
/*  37 */     ti_custnews.setState_code(map.getString("state_code"));
/*  38 */     ti_custnews.setIs_comment(map.getString("is_comment"));
/*  39 */     ti_custnews.setLink_goods_group(map.getString("link_goods_group"));
/*  40 */     ti_custnews.setOut_link(map.getString("out_link"));
/*  41 */     ti_custnews.setUser_id(map.getString("session_user_id"));
/*  42 */     ti_custnews.setUser_name(map.getString("session_user_name"));
/*     */ 
/*  44 */     String result_code = "0";
/*     */     try {
/*  46 */       insert(dbmMgr, ti_custnews);
/*     */     } catch (ApplicationException e) {
/*  48 */       e.printStackTrace();
/*  49 */       result_code = "1";
/*     */     }
/*  51 */     map.setString("result_code", result_code);
/*  52 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_custnews ti_custnews)
/*     */     throws ApplicationException
/*     */   {
/*  61 */     dbmMgr.update("insertTi_custnews", ti_custnews);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  71 */     String pkid_string = map.getString("pkid");
/*  72 */     String result_code = "0";
/*     */     try {
/*  74 */       if (!pkid_string.equals("")) {
/*  75 */         String[] pkStr = pkid_string.split("\\|");
/*  76 */         for (int i = 0; i < pkStr.length; i++) {
/*  77 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  81 */       e.printStackTrace();
/*  82 */       result_code = "1";
/*     */     }
/*  84 */     map.setString("result_code", result_code);
/*  85 */     map.setString("attach_root_id", pkid_string);
/*  86 */     map.setString("attach_sign", "delete");
/*  87 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  96 */     dbmMgr.update("deleteTi_custnews", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 106 */     Ti_custnews ti_custnews = new Ti_custnews();
/* 107 */     ti_custnews.setNews_id(map.getString("news_id"));
/* 108 */     ti_custnews.setCust_id(map.getString("cust_id"));
/* 109 */     ti_custnews.setCh_id_group(map.getString("ch_id_group"));
/* 110 */     ti_custnews.setTitle(map.getString("title"));
/* 111 */     ti_custnews.setContent(map.getString("content"));
/* 112 */     ti_custnews.setTitle_color(map.getString("title_color"));
/* 113 */     ti_custnews.setContent_sub(map.getString("content_sub"));
/* 114 */     ti_custnews.setNews_key(map.getString("news_key"));
/* 115 */     ti_custnews.setAuthor(map.getString("author"));
/* 116 */     ti_custnews.setEditor(map.getString("editor"));
/* 117 */     ti_custnews.setState_code(map.getString("state_code"));
/* 118 */     ti_custnews.setIs_comment(map.getString("is_comment"));
/* 119 */     ti_custnews.setLink_goods_group(map.getString("link_goods_group"));
/* 120 */     ti_custnews.setOut_link(map.getString("out_link"));
/*     */ 
/* 123 */     String result_code = "0";
/*     */     try {
/* 125 */       update(dbmMgr, ti_custnews);
/*     */     } catch (ApplicationException e) {
/* 127 */       e.printStackTrace();
/* 128 */       result_code = "1";
/*     */     }
/* 130 */     map.setString("result_code", result_code);
/* 131 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_custnews ti_custnews)
/*     */     throws ApplicationException
/*     */   {
/* 140 */     dbmMgr.update("updateTi_custnews", ti_custnews);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 151 */     Map params = (Hashtable)obj;
/*     */ 
/* 153 */     if (start == 0)
/* 154 */       start = 0;
/*     */     else {
/* 156 */       start = (start - 1) * limit;
/*     */     }
/* 158 */     params.put("start", Integer.valueOf(start));
/* 159 */     params.put("limit", Integer.valueOf(limit));
/*     */ 
/* 161 */     return this.queryList.getList("getListByTi_custnewsPage", params);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 173 */     Map params = (Hashtable)obj;
/* 174 */     List list = this.queryList.getList("getCountByObjTi_custnews", params);
/* 175 */     int count = 0;
/* 176 */     if ((list != null) && (list.size() > 0)) {
/* 177 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 178 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 179 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 182 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 192 */     return this.queryList.getList("getTi_custnewsByPk", pk);
/*     */   }
/*     */ 
/*     */   public SysMap audit(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 203 */     Ti_custnews ti_custnews = new Ti_custnews();
/* 204 */     String pkid_string = map.getString("pkid");
/* 205 */     String remark = map.getString("remark");
/* 206 */     ti_custnews.setState_code(map.getString("state_code"));
/* 207 */     ti_custnews.setRemark(map.getString("remark"));
/*     */ 
/* 209 */     String result_code = "0";
/*     */     try {
/* 211 */       if (!pkid_string.equals("")) {
/* 212 */         String[] pkStr = pkid_string.split("\\|");
/* 213 */         for (int i = 0; i < pkStr.length; i++) {
/* 214 */           ti_custnews.setNews_id(pkStr[i]);
/* 215 */           if (pkStr[i].equals("")) continue; audit(dbmMgr, ti_custnews);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/* 219 */       e.printStackTrace();
/* 220 */       result_code = "1";
/*     */     }
/* 222 */     map.setString("result_code", result_code);
/* 223 */     return map;
/*     */   }
/*     */ 
/*     */   public void audit(DbmInterf dbmMgr, Ti_custnews ti_custnews)
/*     */     throws ApplicationException
/*     */   {
/* 232 */     dbmMgr.update("auditTi_custnews", ti_custnews);
/*     */   }
/*     */ 
/*     */   public String getnewstitle(String news_id)
/*     */   {
/* 241 */     String title = "";
/* 242 */     List namelist = this.queryList.getList("getnewstitle", news_id);
/* 243 */     if ((namelist != null) && (namelist.size() > 0)) {
/* 244 */       Map map = (Hashtable)namelist.get(0);
/* 245 */       if (map.get("title") != null) {
/* 246 */         title = map.get("title").toString();
/*     */       }
/*     */     }
/* 249 */     return title;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_custnews.Ti_custnewsInfo
 * JD-Core Version:    0.6.0
 */